1. Field of the Invention
The present invention relates to video image processing, and more particularly, to a video image capturing and displaying method and related system.
2. Description of the Prior Art
A video image transferred over a USB, which usually supports only a limited data transfer rate, can consist of as many as tens of thousands of pixels arranged in rows and columns. For example, an eight-bit gray mode video image (one frame) captured by a web camera consists of 352×288 pixels and is around 100 Kbs in size. Image discontinuity is not perceptive to human's eyes if the image display rate is higher than 30 frames per second. However, a USB 1.1 has a data transfer rate of one Mbps and can therefore transfer only 10 frames of the eight-bit gray mode video image per second (100K×10=1M). In order to prevent the image discontinuity from occurring, a video image has to be properly compressed before being transferred over a USB.
Please refer to FIG. 1, which is a block diagram of a video image capturing and displaying system 10 according to the prior art. The video image capturing and displaying system 10 comprises a discrete Cosine transform (DCT) module 12 for transforming a raw video image f(i, j)in spatial domain into a transformed video image F(u, v) in frequency domain, a quantization module 14 for quantizing the transformed video image F(u, v) into a matrix-formed quantized video image Fq(u, v) having low frequency coefficients disposed upper-left while high frequency coefficients disposed lower-right according to a quantization table 16 (non-uniform quantization), a difference pulse code modulation (DPCM) module 18 for generating a DC component of the quantized video image Fq(u, v) by recording only the difference between the quantized video image Fq(u, v) and a quantized video image preceding the quantized video image Fq(u, v) in a zig-zag order and decreasing the code scale of the quantized video image Fq(u, v), a run length encode (RLE) module 20 for generating an AC component of the quantized video image Fq(u, v) by converting consecutive identical characters of the quantized video image Fq(u, v), for example consecutive zeros, into a code consisting of the character and the number making the length of the run, the longer the run, the greater the compression, an entropy coding module 22 connected to the DPCM module 18 and the RLE module 20 for generating a bit-streamed data by modeling and coding the DC and AC components of the quantized video image Fq(u, v) according to a coding table 24, and a buffer 26 of a moderate size for storing the bit-streamed data ready to be transferred over a USB. The bit-streamed data comprises a variety of headers, such as a frame header comprising width/height information and horizontal/vertical sampling factors of the raw video image f(i, j), and a scan header comprising number of components in a scan.
The bit-streamed data generated by the video image capturing and displaying system 10 are transferred via the USB to an image decompression system for recovering the bit-streamed data into the raw video image. The image decompression system decompresses the bit-streamed data in an order reverse to that of a data-compressing process of the video image capturing and displaying system 10, further details hereby omitted.
In contrast to lossless data compressors, such as Huffman, Arithmetic, and LZW used for compressing a text or a program without even a single error introduced, even a single error seriously damaging the meaning of the text or causing the program not to run, the DCT module 12, a so-called lossy data compressor, does not distort the raw video image seriously but introduce some tolerable errors inevitably into the recovered raw video image after the data-compressing and the data-decompressing processes. A trade-off therefore exists between image quality and the degree of compression, i.e. a compression ratio for lossy compression. The greater the compression ratio is, the more distorted the recovered image becomes.
Fortunately, because human's eyes are high frequency roll-off, known video image capturing and displaying systems remove those high frequencies from the transformed video image F(u, v) by adjusting the size of quantization step of the quantization module 14. For example, for uniform quantization, the low frequency coefficients disposed on upper-left corner of the quantized video image Fq(u, v) can be quantized based on a first quantization step, while the high frequency coefficients disposed on lower-right corner of the quantized video image Fq(u, v) are quantized based on a second quantization step having a size larger than that of the first quantization step. Most of the high frequency coefficients are therefore have a value of zero. Alternatively, the coefficients of the quantized video image Fq(u, v) can be quantized based on quantization step of a variable size by looking up a quantization table such as the quantization table 16 for non-uniform quantization.
As mentioned previously, since the USB 1.1 has the data transfer rate of only one Mbps and has to transfer more than 30 frames of image per second to overcome the image discontinuity, and too big (abundance of information) a raw video image cannot be transferred over the USB 1.1 until it has been compressed to be 30 Kb or less in size, a video image capturing and displaying system of the prior art has to comprise a plurality of dedicated components to compress a raw video image and therefore has a bulk size, so as to ensure that any compressed image has a size less than 30 Kb. Accordingly, the buffer 26 of the video image capturing and displaying system 10 has to has a size more than 30 Kb.
There are two kinds of compression mechanisms adopted in the prior art: one is a frame-based compression mechanism, and the other a block-based compression mechanism. The frame-based compression mechanism uses one frame as the basic image compression unit. In other words, all pixels in one frame are compressed under an identical compression mode (the same compression ratio) in the frame-based compression mechanism. This method requires less hardware, is therefore less complicated and more cost effective. However, a group of pixels in one frame usually has different complexity and if these pixels with high complexity are compressed with a low compression ratio, this still leads to too large a compressed video image for transmission over the a USB even after compression. Moreover, the video image capturing and displaying system 10 compresses a raw video image frame by frame, and a compressed video image still having a size larger than 30 Kb cannot be transferred over a USB, so the video image capturing and displaying system 10 has to “dump” too large the whole compressed video image and a hanging phenomenon appears on a display of the video image capturing and displaying system 10. In contrast, if the group of pixels belonging to a simple drawing is compressed with a high compression ratio, the compressed video image has serious distortion.
The block-based compression mechanism, taking one block of a frame as the basic image compression unit, compresses complicated image blocks with a higher compression ratio so that the volume of the compressed data is small enough, and compresses simple image blocks with a lower compression ratio so that the compressed data is more like the raw video image. Although the block-based compression mechanism successfully solves the problems of the frame-based compression mechanism, it divides one frame into blocks and each block unit will be compressed under a specific compression mode. Because the video image capturing and displaying system 10 is designed to display video image according to a line-based order, an additional memory to store these blocks has to be added to the video image capturing and displaying system 10. Therefore, division of one frame increases system hardware and cost. In last, a blocking effect will appear along an edge between any two contagious blocked video images.